<template>
  <div class="not-found">
    <div class="error-container">
      <div class="error-content">
        <svg viewBox="0 0 240 240" class="error-logo">
          <circle cx="120" cy="120" r="110" class="logo-circle" fill="none" />
          <circle cx="120" cy="120" r="85" class="logo-inner-circle" />
          <path
            class="logo-wave"
            d="M60 120 C80 100, 100 140, 120 120 C140 100, 160 140, 180 120"
            fill="none"
          />
          <text x="120" y="140" class="error-text">404</text>
        </svg>
        <h1 class="title">页面未找到</h1>
        <p class="subtitle">抱歉，您访问的页面不存在</p>
        <div class="actions">
          <el-button type="primary" class="home-btn" @click="goHome">返回首页</el-button>
          <el-button class="back-btn" @click="goBack">返回上页</el-button>
        </div>
      </div>
    </div>
  </div>
</template>

<script setup lang="ts">
import { useRouter } from "vue-router";

const router = useRouter();

const goHome = () => {
  router.push("/layout");
};

const goBack = () => {
  router.go(-1);
};
</script>

<style scoped>
.not-found {
  width: 100%;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(rgba(0, 0, 0, 0.6), rgba(0, 0, 0, 0.6)),
    url("@/assets/images/login-bg.jpg") no-repeat center center;
  background-size: cover;
}

.error-container {
  padding: 40px;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.37);
}

.error-content {
  text-align: center;
}

.error-logo {
  width: 200px;
  height: 200px;
  margin-bottom: 20px;
}

.logo-circle {
  stroke: rgba(255, 255, 255, 0.9);
  stroke-width: 2;
  animation: rotate 10s linear infinite;
}

.logo-inner-circle {
  fill: rgba(255, 255, 255, 0.1);
  stroke: rgba(255, 255, 255, 0.6);
  stroke-width: 1;
  animation: pulse 2s ease-in-out infinite;
}

.logo-wave {
  stroke: rgba(255, 255, 255, 0.9);
  stroke-width: 3;
  stroke-linecap: round;
  animation: wave 3s ease-in-out infinite;
}

.error-text {
  fill: #ffffff;
  font-size: 48px;
  font-weight: bold;
  text-anchor: middle;
  animation: shake 0.5s ease-in-out infinite;
}

.title {
  color: #ffffff;
  font-size: 28px;
  margin: 20px 0 10px;
  font-weight: 500;
}

.subtitle {
  color: rgba(255, 255, 255, 0.8);
  font-size: 16px;
  margin-bottom: 30px;
}

.actions {
  display: flex;
  gap: 16px;
  justify-content: center;
}

.home-btn,
.back-btn {
  width: 120px;
  height: 40px;
  border-radius: 8px;
  font-size: 14px;
  transition: all 0.3s ease;
}

.home-btn {
  background: linear-gradient(45deg, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.7));
  color: #20364d;
  border: none;
}

.home-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(255, 255, 255, 0.3);
}

.back-btn {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: rgba(255, 255, 255, 0.9);
}

.back-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  transform: translateY(-2px);
}

@keyframes rotate {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

@keyframes pulse {
  0%,
  100% {
    transform: scale(1);
    opacity: 0.8;
  }
  50% {
    transform: scale(1.05);
    opacity: 0.6;
  }
}

@keyframes wave {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(10px);
  }
}

@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-2px);
  }
  75% {
    transform: translateX(2px);
  }
}
</style>
